package track
{
	import utils.Vector2D;

	/**
	 * 0	 直线型
	 **/
	public class TrackLine extends TrackProto
	{
		private static var _instance:TrackLine;
		public function TrackLine():void
		{
			super();
		}
		
		public static function getInstance():TrackLine{
			return _instance ||= new TrackLine();
		}
		
		override public function make(subTypeId:uint):Array{
            var startX:int;
            var startY:int;
            var endX:int;
            var endY:int;
		    switch(subTypeId){
		        case 0://左到右的直线
                    startX = -100;
                    startY = Const.HEIGHT * 0.5 * Math.random() + Const.HEIGHT * 0.25;
                    endX = Const.WIDTH + 100;
                    endY = Const.HEIGHT * 0.5 * Math.random() + Const.HEIGHT * 0.25;
		            break;
		        case 1://右到左的直线
                    startX = Const.WIDTH + 100;
                    startY = Const.HEIGHT * 0.5 * Math.random() + Const.HEIGHT * 0.25;
                    endX = -100;
                    endY = Const.HEIGHT * 0.5 * Math.random() + Const.HEIGHT * 0.25;
		            break;
		        case 2://上到下的直线
                    startX = Const.WIDTH * 0.5 * Math.random() + Const.WIDTH * 0.25;
                    startY = -100;
                    endX = Const.WIDTH * 0.5 * Math.random() + Const.WIDTH * 0.25;
                    endY = Const.HEIGHT + 100;
		            break;
                case 3://下到上的直线
                    startX = Const.WIDTH * 0.5 * Math.random() + Const.WIDTH * 0.25;
                    startY = Const.HEIGHT + 100;
                    endX = Const.WIDTH * 0.5 * Math.random() + Const.WIDTH * 0.25;
                    endY = -100;
                    break;
                case 4://下右到左上的直线
                    startX = Const.WIDTH * 0.25 * Math.random() + Const.WIDTH * 0.5;
                    startY = Const.HEIGHT + 100;
                    endX = -100;
                    endY = Const.HEIGHT * 0.5 * Math.random();
                    break;
                case 5://左上到下右的直线
                    startX = -100;
                    startY = Const.HEIGHT * 0.5 * Math.random();
                    endX = Const.WIDTH * 0.25 * Math.random() + Const.WIDTH * 0.5;
                    endY = Const.HEIGHT + 100;
                    break;
                case 6://下左到右上的直线
                    startX = Const.WIDTH * 0.25 * Math.random() + Const.WIDTH * 0.25;
                    startY = Const.HEIGHT + 100;
                    endX = Const.WIDTH + 100;
                    endY = Const.HEIGHT * 0.5 * Math.random();
                    break;
                case 7://右上到下左的直线
                    startX = Const.WIDTH + 100;
                    startY = Const.HEIGHT * 0.5 * Math.random();
                    endX = Const.WIDTH * 0.25 * Math.random() + Const.WIDTH * 0.25;
                    endY = Const.HEIGHT + 100;
                    break;
                case 8://右下到上左的直线
                    startX = Const.WIDTH + 100;
                    startY = Const.HEIGHT * 0.5 * Math.random() + Const.HEIGHT * 0.5;
                    endX = Const.WIDTH * 0.5 * Math.random();
                    endY = -100;
                    break;
                case 9://上左到右下的直线
                    startX = Const.WIDTH * 0.5 * Math.random();
                    startY = -100;
                    endX = Const.WIDTH + 100;
                    endY = Const.HEIGHT * 0.5 * Math.random() + Const.HEIGHT * 0.5;
                    break;
                case 10://左下到上右的直线
                    startX = -100;
                    startY = Const.HEIGHT * 0.5 * Math.random() + Const.HEIGHT * 0.5;
                    endX = Const.WIDTH * 0.5 * Math.random() + Const.WIDTH * 0.5;
                    endY = -100;
                    break;
                case 11://上右到左下的直线
                    startX = Const.WIDTH * 0.5 * Math.random() + Const.WIDTH * 0.5;
                    startY = -100;
                    endX = -100;
                    endY = Const.HEIGHT * 0.5 * Math.random() + Const.HEIGHT * 0.5;
                    break;
		    }
            pathArr.push(new Vector2D(startX, startY));
            pathArr.push(new Vector2D(endX, endY));
			return pathArr;
		}
	}
}
